﻿@using SharePointAccessMonitor
@model SharePointAccessMonitor.Models.MainViewModel
@{
    ViewBag.Title = Model.SharePointUrl;
}
<div class="container-fluid">
    <div class="row">
        <div class="col-md-10">
            <canvas id="summary-chart" height="100" width="400"></canvas>
        </div>
        <div class="col-md-2">
            <div class="panel panel-default">
                <div class="panel-heading">
                    @(MessageResource.MonitorStatus)
                </div>
                <div class="panel-body" style="width:100%;">
                    <dl>
                        <dt>@(MessageResource.LoggingStatus)</dt>
                        <dd>
                            <div class="btn-group toggle_buttong" id="logging-status">
                                @if (Model.Monitoring)
                                {
                                    <button id="loggging-off-button" type="button" class="btn btn-info locked_active">OFF</button>
                                    <button id="loggging-on-button" type="button" class="btn btn-default unlocked_inactive">ON</button>
                                }
                                else
                                {
                                    <button id="loggging-off-button" type="button" class="btn btn-default unlocked_inactive">OFF</button>
                                    <button id="loggging-on-button" type="button" class="btn btn-info locked_active">ON</button>
                                }
                            </div>
                        </dd>
                    </dl>
                    <dl>
                        <dt>@(MessageResource.ServerConnectionStatus)</dt>
                        <dd>
                            <div class="btn-group toggle_buttong" id="connection-status">
                                <button id="connection-off-button" type="button" class="btn btn-info locked_active">OFF</button>
                                <button id="connection-on-button" type="button" class="btn btn-default unlocked_inactive">ON</button>
                            </div>
                        </dd>
                    </dl>
                </div>
            </div>

        </div>
    </div>
    <hr />
    <div class="row">
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-md-8">
                            <h3 class="panel-title">
                                @(MessageResource.ActiveUser)
                                <span id="active-user-count" class="label label-default"></span>
                            </h3>
                        </div>
                        <div class="col-md-4">
                            <span class="pull-right">
                                <a href="#" id="clear-active-user">@(MessageResource.Clear)</a>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="panel-body" style="overflow:auto;height:200px;width:100%;">
                    <table id="userlist" class="table">
                        <tbody>
                            <tr><td></td><td class="counter"></td></tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-md-8">
                            <h3 class="panel-title">
                                @(MessageResource.PopularDocument)
                            </h3>
                      </div>
                        <div class="col-md-4">
                            <span class="pull-right">
                                <a href="#" id="clear-popular-document">@(MessageResource.Clear)</a> 
                            </span>
                        </div>
                    </div>
                </div>
                <div class="panel-body" style="overflow:auto;height:200px;width:100%;">
                    <table id="filelist" class="table" >
                        <tbody>
                            <tr><td></td><td class="counter"></td></tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="row">
                        <div class="col-md-8">
                            <h3 class="panel-title">
                                @(MessageResource.PopularContent)
                            </h3>
                        </div>
                        <div class="col-md-4">
                            <span class="pull-right">
                                <a href="#" id="clear-popular-content">@(MessageResource.Clear)</a>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="panel-body" style="overflow:auto;height:200px;width:100%;">
                    <table id="listlist" class="table">
                        <tbody>
                            <tr><td></td><td class="counter"></td></tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12" style="min-height:300px;">
            <table id="messagelist" class="table">
                <thead>
                    <tr><th width="20%">@(MessageResource.Timestamp)</th><th>@(MessageResource.Title)</th><th width="30%">@(MessageResource.User)</th></tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/bootstrap.js"></script>
<script src="~/Scripts/jquery.signalR-2.2.0.js"></script>
<script src="~/signalr/hubs"></script>
<script src="~/Scripts/Chart.js"></script>
<script src="~/Scripts/app-monitor.js"></script>
<script>
    var view = new Monitor.MainViewModel();
    @{
        var messages = new string[] { nameof(MessageResource.AccessCount), nameof(MessageResource.OffStatus), nameof(MessageResource.OnStatus), };
        foreach(var item in messages)
        {
            <text>view.messageResource['@(item)'] = '@(MessageResource.ResourceManager.GetString(item))';</text>
        }
    }
    view.init();

</script>

